public class Test {
    public static void main(String[] args) {

    }
    public static void main3(String[] args) {
        int n = 7;
        for (int i = 31; i >= 0; i-=2) {
            System.out.print(((n>>>i)&1)+" ");
        }
        System.out.println("");
        for(int i = 30;i>=0;i-=2){
            System.out.print(((n>>>i)&1)+" ");
        }
    }

    public static void main2(String[] args) {
        //写一个函数返回参数二进制中1的个数
        int n = 15;
        int count = 0;
        while (n != 0) {
            count++;
            n = n & (n - 1);
        }
        System.out.println(count);
    }

    public static void main1(String[] args) {

        for (int i = 0; i < 999999; i++) {
            int count = 0;
            int tmp = i;
            while (tmp != 0) {
                count++;
                tmp = tmp / 10;
            }
            tmp = i;
            int sum = 0;
            while (tmp != 0) {
                sum += Math.pow(tmp % 10, count);
                tmp /= 10;

            }
            if (sum == i) {
                System.out.println(i);
            }
        }

    }
}
